<script language="javascript">
// add multiple select / deselect functionality : Starts
$(function(){
  
  $(".selectall").click(function () {
    $('.case'+$(this).val()).attr('checked', this.checked);
  });
});
// add multiple select / deselect functionality : Ends
</script>
<br />
<table border="1" align="center" width="75%" padding="3px">
<tr>
  <td align="left" class="table4" colspan="6">Company Name : {$companyName}</td>
  <td align="left" class="table4" colspan="3" NOWRAP>Challan Type : {$challanType}</td>
</tr>
<tr>
  <td class="table5" align="center">&nbsp;</td>
  <td class="table5" align="center">Sr.No.</td>
  <td class="table5" align="center">Date</td>
  <td class="table5" align="center">Challan No.</td>
  <td class="table5" align="center">&nbsp;</td>
  <td class="table5" align="center">Product</td>
  <td class="table5" align="center">Qty. Supplied</td>
  <td class="table5" align="center">Qty. Returned</td>
  <td class="table5" align="center">Net Qty.Used</td>
</tr>
{section name="sec" loop=$deliveryChallanArray}
  {assign var="countRow" value="0"}
  {section name="sec1" loop=$deliveryDetailArray[sec]}
  <input type="hidden" name="countRow" value="{$countRow++}">
  <tr>
    {if $allowance[sec][sec1].allow == 0}
    <td align="center"><input type="checkbox" class="selectall" name="deliveryChallanMasterId[]" value="{$deliveryChallanArray[sec].deliveryChallanMasterId}" /></td>
    <td align="center">{$smarty.section.sec.rownum}</td>
    <td align="center" NOWRAP>{$deliveryChallanArray[sec].delivaryDate}</td>
    <td align="center">{$deliveryChallanArray[sec].srNo}</td>
    {else}
    <td align="center">&nbsp;</td>
    <td align="center">&nbsp;</td>
    <td align="center">&nbsp;</td>
    <td align="center">&nbsp;</td>
    {/if}
    <td align="center"><input type="checkbox" class="case{$deliveryChallanArray[sec].deliveryChallanMasterId}" id="deliveryChallanDetailId[]" name="deliveryChallanDetailId[{$deliveryDetailArray[sec][sec1].deliveryChallanDetailId}]" value="{$deliveryDetailArray[sec][sec1].deliveryChallanDetailId}" /></td>
    <td align="center">{$deliveryDetailArray[sec][sec1].itemName}</td>
    <td align="center">{$deliveryDetailArray[sec][sec1].quantity}</td>
    <td align="center">0</td>
    <td align="center"><input type="text" name="qtyTaken[{$deliveryDetailArray[sec][sec1].deliveryChallanDetailId}]" id="qtyTaken[]" size="2" value="{$deliveryDetailArray[sec][sec1].quantity}" /></td>
  </tr>
  {sectionelse}
    <td align="center">&nbsp;</td>
  {/section}
  
{/section}
</table>
{if $countRow == 0}
   <tr class="table2">
	 <td align="center" colspan="10"><h2><center><font color="red"><b>{$msg}</b></font></center></h2></td>
   </tr>
{/if}
{if $countRow != 0}
<br />
<center><input type="submit" name="submitDateBtn" value="Submit" class="button"/></center>
{/if}